package com.evil.mi.enums;

import com.evil.mi.enums.base.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;

/**
 * com.evil.mi.enums
 *
 * @author 白雨浓
 * date: 2018/8/20 9:39
 * content:
 */
@Getter
@AllArgsConstructor
public enum VideoStateEnum implements BaseEnum {

    INIT("INIT", "初始化", 1),

    DOWNLOADING("DOWNLOADING", "下载中", 2),

    FINISH("FINISH", "完成", 3),

    ALTERNATIVE("ALTERNATIVE", "备选", 4),

    INVALID("INVALID", "无效", -9);

    private String code;
    private String msg;
    private int index;


    @Override
    public VideoStateEnum getEnumByCode(String code) {
        for (VideoStateEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    @Override
    public VideoStateEnum getEnumByIndex(int index) {
        for (VideoStateEnum value : values()) {
            if (value.getIndex() == index) {
                return value;
            }
        }
        return null;
    }
}
